home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / comms / other / magicfile / goodies / cleandiz.rx next >
Text File  |  1999-04-21  |  2KB  |  76 lines

  1. /* 
  2.    $VER: CleanDIZ 1.3 (9.4.98) ©1998 Steve Clack (with fix by Er!ny)
  3.    
  4.    Looks for & removes orphan file descriptions in MAX's Pro 2, ie. if you
  5.    delete a file in the filebase its file_id.diz won't be removed - this
  6.    does that job.
  7.    
  8.    Freely distributable but please credit me :o).
  9.    
  10.    Requires `FSearch' to be present in `C:' (included).
  11.    
  12.    Template: rx CleanDIZ.rx
  13.    
  14.    ----------------------------------------------------------------------------
  15.    
  16.    Er!ny:
  17.    Steve's version should have in theory worked but he screwed up on
  18.    two counts >:).  1: He forgot to put the "NOPREFS" argument after the
  19.    call to flashfind, causing it to stall for about half an hour and 2:
  20.    it didn't actually nuke the dizes, as he forgot to put ".diz" after the
  21.    'line' variable i.e it WANTED to nuke "file_id.diz" but only tried to nuke
  22.    "file_id".  My fixed version works 119% as it is case sensitive still :)
  23.  
  24.    Steve:
  25.    NOPREFS was a nice idea, and it probably seemed as though it worked because
  26.    FlashFind is very intermittent but the problem was with FlashFind's binary
  27.    search routines & it didn't like being launched from AREXX so I changed the
  28.    searching util. Fixed the problem :). Now uses FSearch!
  29.    
  30.    ----------------------------------------------------------------------------
  31.    
  32.    Notes: Reads `Diz:' directory & checks `BBS:Files/File.index'; if yours
  33.    is different please change below...
  34. */
  35.  
  36. DIZ_DIR = "Diz:"
  37. FILE_INDEX = "BBS:Files/"
  38.  
  39. options results
  40. options failat 99
  41. address command
  42.  
  43. Say "CleanDIZ 1.3 ©1998 Steve Clack for MAX's Pro 2 (fix by Er!ny^Scart)"
  44.  
  45. 'Copy >nil: 'FILE_INDEX'File.index RAM:'
  46. 'Copy >nil: C:FSearch RAM:'
  47. 'List >T:DIZ.TMP 'DIZ_DIR' LFORMAT="%m"'
  48.  
  49. Wait 1
  50.  
  51. Say 'Looking for orphan file descriptions, please wait...'
  52.  
  53. DELETED = 0
  54.  
  55. call open(DIZFILE,'T:DIZ.TMP',R)
  56. do until eof(DIZFILE)
  57.    LINE = readln(DIZFILE)
  58.  
  59.    if LINE ~= '' then do
  60.       'RAM:FSearch >nil: RAM:File.index "'LINE'"'
  61.       STATUS = rc
  62.  
  63.       if STATUS=5 then do
  64.          'Delete >nil: 'DIZ_DIR''LINE'.diz'
  65.          DELETED = DELETED + 1
  66.       end
  67.   end
  68. end
  69. call close DIZFILE
  70.  
  71. 'Delete >nil: RAM:FSearch'
  72. 'Delete >nil: RAM:File.index'
  73.  
  74. Say 'Operation complete. Removed 'DELETED' orphans!'
  75. exit
  76.